{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "82321cca",
   "metadata": {},
   "source": [
    "# 本周学习目标\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "419418a0",
   "metadata": {},
   "source": [
    "1. 模块\n",
    "2. 变量\n",
    "3. 循环变量"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9c0fcf31",
   "metadata": {},
   "source": [
    "# 1.模块\n",
    "## 1.1模块（标准库）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5c45c9b3",
   "metadata": {},
   "source": [
    "Python创始人团队为后面使用这门编程语言的人们提供的解决日常生活可能使用到的功能，而制作的可以方便使用的模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "fe76ca31",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2dae7c12",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1665313247.79457"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 纪元（1970.1.1）\n",
    "# 时间戳\n",
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "0f575c1d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1665313261.9927027"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "11af68c6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=10, tm_mday=9, tm_hour=19, tm_min=1, tm_sec=28, tm_wday=6, tm_yday=282, tm_isdst=0)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a6e63581",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=10, tm_mday=9, tm_hour=11, tm_min=1, tm_sec=39, tm_wday=6, tm_yday=282, tm_isdst=0)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7fffb8bb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Sun Oct  9 19:02:00 2022'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.asctime(time.localtime())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7358fadb",
   "metadata": {},
   "source": [
    "# 1.2模块（开源模块）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c38fe202",
   "metadata": {},
   "source": [
    ">1. 因为代码开源\n",
    ">2. 集合全领域（全人类）的需求\n",
    ">3. 按照国际标准开放的模块库"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e6e43beb",
   "metadata": {},
   "source": [
    "[资源地址] （https://pypi.org/）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4e9d30be",
   "metadata": {},
   "source": [
    "#  1.3模块（自定义模块）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bb5b446c",
   "metadata": {},
   "source": [
    "> 1. 不愿意开端的有一定知识产权的（开放API租用形式开放）\n",
    "> 2. 自己用的，写的也不怎么好，开源出去丢人的"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43dd9094",
   "metadata": {},
   "source": [
    "# 2.变量"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ffc3118a",
   "metadata": {},
   "source": [
    "> 1. 声明变量（明名）规则\n",
    ">>1. 变量只能是字母，数字或下划线的任意组合\n",
    ">>2. 变量名的第一个字符不能是数字\n",
    ">>3. 以下关键字不能声明为变量名['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda','not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield'] 在jupyter 中显示绿色的不能命名\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "17a91eaf",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01_name = \"Xiao Hong\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b49e2633",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Xiao Hong'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01_name"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "70699f45",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1494416083632"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(网三_01_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "5d0e64d9",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (3921599760.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn [16], line 1\u001b[1;36m\u001b[0m\n\u001b[1;33m    1网三 = \"xiaoming\"\u001b[0m\n\u001b[1;37m     ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    " 1网三 = \"xiaoming\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "0e492e95",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01_age = 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "23b28d88",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "19"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01_age"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "cb1734f7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "180000001 180000001\n",
      "180000006 180000001\n"
     ]
    }
   ],
   "source": [
    "# 案例（关于变量）\n",
    "网三_01_ID = \"180000001\"\n",
    "网三_02_ID = 网三_01_ID\n",
    "print(网三_01_ID,网三_02_ID)\n",
    "网三_01_ID = \"180000006\"\n",
    "print(网三_01_ID,网三_02_ID)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
